package dao.mysql;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;

//数据库辅助类
public class DBHelper {

    public static Connection databaselink;

    public static Connection getConnection() {
        String databaseName ="petstore";
        String databaseUser ="root";
        String databasePassword ="123456";
        String url ="jdbc:mysql://localhost/"+databaseName;

        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            databaselink = DriverManager.getConnection(url,databaseUser,databasePassword);

        }catch(Exception e) {
            e.printStackTrace();
            e.getCause();
        }

        return databaselink;
    }
}
